﻿<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="searchUser.aspx.vb" Inherits="GoodAnotApp.searchUser" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:Panel ID="Panel1" runat="server">
            <asp:TextBox ID="tbxName" runat="server"></asp:TextBox>
            <asp:DropDownList ID="DropDownList1" runat="server">
                <asp:ListItem>Email Address</asp:ListItem>
                <asp:ListItem>Display Name</asp:ListItem>
            </asp:DropDownList>
            <asp:Button ID="btnSearch" runat="server" Text="Search" />
            <asp:Label ID="lblError" runat="server" Text="Label" Visible="False" 
                ForeColor="Red"></asp:Label>
            <br />
            <asp:GridView ID="GridView2" runat="server">
                <Columns>
                    <asp:ButtonField CommandName="Promote" Text="Promote" />
                    <asp:ButtonField CommandName="Demote" Text="Demote" />
                </Columns>
            </asp:GridView>
            <br />
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="Data Source=JOLENE-PC;Initial Catalog=goodAnotDB;Integrated Security=True" 
                ProviderName="System.Data.SqlClient" 
                
                
                
                
                SelectCommand="SELECT email, display_name, first_name, last_name, is_admin FROM user_account WHERE (email LIKE @email + '%')" 
                UpdateCommand="UPDATE [user_account] SET is_admin = @is_admin WHERE email = @email">
                <SelectParameters>
                    <asp:ControlParameter ControlID="tbxName" Name="email" PropertyName="Text" />
                </SelectParameters>
                <UpdateParameters>
                    <asp:Parameter Name="is_admin" />
                    <asp:Parameter Name="email" />
                </UpdateParameters>
            </asp:SqlDataSource>
            <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                ConnectionString="Data Source=JOLENE-PC;Initial Catalog=goodAnotDB;Integrated Security=True" 
                ProviderName="System.Data.SqlClient" 
                
                
                SelectCommand="SELECT [email], [display_name], [first_name], [last_name], [is_admin] FROM [user_account] WHERE ([display_name] LIKE @display_name + '%')" 
                UpdateCommand="UPDATE [user_account] SET is_admin = @is_admin WHERE email = @email">
                <SelectParameters>
                    <asp:ControlParameter ControlID="tbxName" Name="display_name" 
                        PropertyName="Text" Type="String" />
                </SelectParameters>
                <UpdateParameters>
                    <asp:Parameter Name="is_admin" />
                    <asp:Parameter Name="email" />
                </UpdateParameters>
            </asp:SqlDataSource>
            <br />
        </asp:Panel>
    
    </div>
    </form>
</body>
</html>
